
clear 

** read in .dta file **

use "${clean}/who_counts_analysis.dta", clear

** full regression results for MOB outcome **


** regressions ** 

xi: reghdfe MOB did_ANY, a(geo2_ma reg_fe YOB) cluster(geo2_ma)
estadd local controls = "$$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_MOB_did_BW2_none

xi: reghdfe MOB did_ANY Arabic Female *_itTREATED *_itANYFOR, a(geo2_ma reg_fe YOB) cluster(geo2_ma)
estadd local controls = "$\surd$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_MOB_did_BW2_any

drop if YOB > 1955

xi: reghdfe MOB did_ANY, a(geo2_ma reg_fe YOB) cluster(geo2_ma)
estadd local controls = "$$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_MOB_did_BW1_none

xi: reghdfe MOB did_ANY Arabic Female *_itTREATED *_itANYFOR, a(geo2_ma reg_fe YOB) cluster(geo2_ma)
estadd local controls = "$\surd$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_MOB_did_BW1_any
estimates store m_MOB_did_BW1_any

** Output Table **

#delimit ; 
estout 
m_MOB_did_BW1_none
m_MOB_did_BW1_any
m_MOB_did_BW2_none
	   m_MOB_did_BW2_any
       using "${output}/tables/TableA6.tex",
       style(tex) 
       cells(b(star fmt(3)) se(par fmt(3))) 
varlabels(did_ANY "Difference in Differences, registration" Female "Female " Arabic "First Language Arabic " MUNI_FOR_1950 "Foreign Population (1950) " Arabic_itTREATED "Arabic, Post 1950 Interaction " Female_itTREATED "Female, Post 1950 Interaction" Coastal "Coastal" elev_mean "Mean Altitude (Province)" popd_1910_itTREATED " Estimate Pre-colonial population density, Post 1950 Interaction "  Coastal_itTREATED "Coastal Post 1950 Interaction" elev_mean_itTREATED "Mean Elevation Post 1950 Interaction" cropland1910_itTREATED "Estimated pre-colonial Cropland Post 1950 Interaction" Arabic_itANYFOR "Arabic Foreign Municipal Population Share interaction" Female_itANYFOR "Female Foreign Municipal Population Share interaction" Coastal_itANYFOR "Coastal Foreign Municipal Population Share interaction" ARABIC_itANYFOR "Arabic Historic European Population Interaction " elev_mean_itANYFOR "Mean Elevation Foreign Municipal Population Share interaction" cropland1910_itANYFOR "Estimated pre-colonial Cropland Foreign Municipal Population Share interaction" popd_1910_itANYFOR "Estimated pre-colonial population density Foreign Municipal Population Share interaction" ec_total_itTREATED "Civil Registration Offices, Post 1950 Interaction")
       drop(_cons Coastal_itANYFOR elev_mean_itANYFOR cropland1910_itANYFOR popd_1910_itANYFOR ec_total_itANYFOR)
	   stats(controls
	   adminFE
             r2 
             N
			 ymean, fmt(0 0 2 0 3 %9.0gc %9.0gc)
             labels("\hline Controls"
			 "\hline Admin FE"
                   "\hline \(R^2\)" 
                  " \hline N"
				   "Dep. Var. Mean "))
       mlabels(,none) 
       numbers
       collabels(none) 
       starl(* 0.1 ** 0.05 *** 0.01)
	          prehead( 
           \begin{table}[H]
           \caption{Effect of 1950 Reform and European Settlement on Registration}        
           \label{tab:DiD_MOB}            
           \centering
           \begin{tabular}{@{\extracolsep{4pt}}l*{@M}{c}@{}} 
           \hline \hline             
		   & \multicolumn{1}{p{3cm}}{\centering Registration \\ 1945-1955}    
		   & \multicolumn{1}{p{3cm}}{\centering Registration \\ 1945-1955}  
		   & \multicolumn{1}{p{3cm}}{\centering Registration \\ 1945-1962}                        
		   & \multicolumn{1}{p{3cm}}{\centering Registration \\ 1945-1962}                  \\
       )
       posthead(\hline) 
       prefoot() 
       postfoot(
           \noalign{\smallskip} \hline \hline 
           \end{tabular}
           \medskip
           \begin{minipage}{.9\textwidth}
           \tiny \justify Notes: \( @starlegend \). 
           \\ Fixed Effects and Clustered Robust Standard Errors at Province.
           \end{minipage}        
       \end{table}
       )
       replace;
#delimit cr
